﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _18.Memento
{
    class GameRole
    {
        private int vit;

        private int atk;

        private int def;

        public int Vit { get => vit; set => vit = value; }

        public int Atk { get => atk; set => atk = value; }

        public int Def { get => def; set => def = value; }

        public void GetInitState()
        {
            this.vit = 100;
            this.atk = 100;
            this.def = 100;
        }

        public void Fight()
        {
            this.vit = 0;
            this.atk = 0;
            this.def = 0;
        }

        public RoleStateMemento SaveState()
        {
            return (new RoleStateMemento(Vit, Atk, Def));
        }

        public void RecoveryState(RoleStateMemento memento)
        {
            this.vit = memento.Vit;
            this.atk = memento.Atk;
            this.def = memento.Def;
        }

        public void StateDisplay()
        {
            Console.WriteLine("角色当前状态：");
            Console.WriteLine("体力：{0}", this.vit);
            Console.WriteLine("攻击力：{0}", this.atk);
            Console.WriteLine("防御力：{0}", this.def);
            Console.WriteLine("");
        }
    }
}
